Skip to content

enforce quote-props lint #6513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 8, 2023
Merged

enforce quote-props lint #6513

merged 3 commits into from
Mar 8, 2023

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Mar 8, 2023

Addressing #6428 (comment) by using as-needed option.
See https://eslint.org/docs/latest/rules/quote-props for more details.

Please note that for files in lib/locales folder the rule is set to consistent.

It is also disabled for regl_precompiled.js files by b8e0041.

@plotly/plotly_js

You could simply run the following to fix all the files:

npm run lint -- --fix

@@ -127,7 +127,7 @@ module.exports = function drawArrowHead(el3, ends, options) {

d3.select(el.parentNode).append('path')
.attr({
'class': el3.attr('class'),
class: el3.attr('class'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcjohnson Do you recall if quotes around class are needed here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class is a reserved word, so it made me squeamish to leave it unquoted. But This note implies it's been fine for quite a long time:

Note: ECMAScript 3 didn’t allow the use of unquoted reserved words as property names. Here’s the full list of ES3 reserved words: abstract, boolean, break, byte, case, catch, char, class, const, continue, debugger, default, delete, do, double, else, enum, export, extends, false, final, finally, float, for, function, goto, if, implements, import, in, instanceof, int, interface, long, native, new, null, package, private, protected, public, return, short, static, super, switch, synchronized, this, throw, throws, transient, true, try, typeof, var, void, volatile, while, and with. Avoid using these as unquoted property names if backwards compatibility is a concern.

This is fine in ES5 and beyond 🎉

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha OK, this was a lot more widespread than I realized 😅
Thanks 💃

@archmoj archmoj merged commit 1d21d64 into master Mar 8, 2023
@archmoj archmoj deleted the quote-props-as-needed branch March 8, 2023 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants